package com.zcl.protocol;

import com.netqin.ui.share.sinaweibo.AsyncWeiboRunner.RequestListener;

import android.content.Context;

public abstract class APPProBase {
	protected String REQUEST_SHOW_USERS = "https://api.weibo.com/2/users/show.json";
	
	protected String SOURCE_PARAM = "source";
	protected String ACCESS_TOKEN_PARAM = "access_token";
	protected String UID_PARAM = "uid";
	protected String SCREEN_NAME_PARAM = "screen_name";
	protected int mReqInfo = -1;
	protected Context mContext;
	protected Object mObject;
	protected RequestListener mRequestListener;
	/**
     * 构造函数
     * 
     * @param protocolID
     */
    public APPProBase(int reqinfo, Context context, Object obj) {
        mReqInfo = reqinfo;
        mContext = context;
        mObject = obj;
    }
    /**
     * 组装请求报文
     * @param context
     */
    public abstract boolean generateRequestData(Context context);
    
    /**
     * 解析返回报文
     * @param context
     * @return
     */
    public abstract boolean parseResponseData(Context context, String source);
    
    /**
     * 注册微博请求监听器
     * @param listener
     */
    public void addRequestListener(RequestListener listener)
    {
    	mRequestListener = listener;
    }
    
    /**
     * 获取解析完的数据
     * @return
     */
    public Object getParseData()
    {
    	return mObject;
    }
    
    public int getProtocolType()
    {
    	return mReqInfo;
    }
}
